package com.boil.demo.ioc.car02;
// +-------------------------------------------------------------
// | Created by IntelliJ IDEA.
// +-------------------------------------------------------------
// | Author      : linhai
// +-------------------------------------------------------------
// | Date        : 2019-05-05 22:50
// +-------------------------------------------------------------
// | Description :
// +-------------------------------------------------------------

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestCar {

    @Test
    public void TestCar02_1() {

        int size = 50;

        Tire tire = new Tire(size);

        Bottom bottom = new Bottom(tire);

        Framework framework = new Framework(bottom);

        Car car = new Car(framework);

        car.run();
    }


    @Test
    public void TestCar02_2() {

        ApplicationContext context =
                new ClassPathXmlApplicationContext("applicationContext02.xml");

        Car car = (Car) context.getBean("car");

        car.run();
    }
}
